home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 25 / Cream of the Crop 25.iso / os2 / kzr0597.zip / KZR0.CMD < prev    next >
OS/2 REXX Batch file  |  1997-02-14  |  3KB  |  113 lines

  1. /* kzr0.CMD */
  2.    "@ echo off"
  3.    Numeric Digits 48
  4.    pi=3.141592653589793238462643383279502884197169399375105820975
  5.    ND=50
  6.    Call RxFuncAdd 'SysLoadFuncs', RexxUtil, 'SysLoadFuncs'
  7.    Call SysLoadFuncs
  8.    Pfd=SysSearchPath("PATH", "kzr0.cmd")
  9.    lp=LastPos("\", Pfd)
  10.    Pfd=DelStr(Pfd, 1+lp)
  11.    buferg=Pfd||"Ergebnis.DAT"
  12.    bufND =Pfd||"NDZahl.DAT"
  13.    ret=LineOut(bufND, ND)
  14.    zz = LineIn(buferg, 1)
  15.    z=zz
  16.    Call charout(buferg)
  17.    Call SysFileDelete buferg
  18.  
  19.    parse arg str;   str=strip(str)
  20.    parse UPPER value str with s2 ';' v1 ',' v2
  21.  
  22.    if (length(str)= 0) then do; "view.exe" Pfd||"KZR.INF"; EXIT;end
  23.    if Pos("DIVGANZ", s2) > 0 then Call Flt3 s2; else s3=s2
  24.    if Pos("DIVREST", s3) > 0 then Call Flt4 s3; else s4=s3
  25.  
  26.    if length(V1) > 0 & length(V2) > 0 then
  27.    do
  28.    /* Hier ist zweimal ein Semikolon erforderlich, */
  29.    /* da Trennung von drei REXX-Anweisungen        */
  30.      st=v1||";"||v2||";   "||"z = "||s2
  31.      Signal NV
  32.    end
  33.  
  34.    if length(v1) > 0 & length(v2) = 0 then
  35.    do
  36.    /* Hier ist einmal ein Semikolon erforderlich,  */
  37.    /* da Trennung von zwei REXX-Anweisungen        */
  38.      st=v1||";   "||"z = "||s2
  39.      Signal NV
  40.    end
  41.  
  42.    if length(v2) > 0 & length(v1) = 0 then
  43.    do
  44.    /* Hier ist einmal ein Semikolon erforderlich,  */
  45.    /* da Trennung von zwei REXX-Anweisungen        */
  46.      st=v2||";   "||"z = "||s2
  47.      Signal NV
  48.    end
  49. NV:
  50.    Numeric Digits ND
  51.    interpret st
  52.    if DataType(z, N) = 1 then
  53.    do
  54.      Numeric Digits ND
  55.      zz=Format(z)
  56.      st10=ErgFormat(zz)
  57.    end
  58.    else st10=z
  59.    say; say st10
  60.    ret=LineOut(buferg, st10)
  61.    Call charout(bufND);  Call SysFileDelete bufND
  62.    Call charout(bufMsg); Call SysFileDelete bufMsg
  63.    Dummy=MinNDA()
  64. EXIT
  65.  
  66. Flt3:
  67.    parse arg s2
  68.    i=1; s3.i=s2
  69.    A3:
  70.    j=i+1
  71.    l3.i=Pos("DIVGANZ", s3.i); if l3.i > 0 then Signal w31
  72.    w31:
  73.    if l3.i=0 then Signal w3e
  74.    b3.i=SubStr(s3.i, l3.i, 7)
  75.    s3.i=DelStr(s3.i, l3.i, 7)
  76.    if b3.i=="DIVGANZ" then n3.i="%"
  77.    s3.j=Insert(n3.i, s3.i, l3.i-1); s3=s3.j
  78.    i=i+1
  79.    signal A3
  80.    w3e:
  81.    Return
  82.  
  83. Flt4:
  84.    parse arg s3
  85.    i=1; s4.i=s3
  86.    A4:
  87.    j=i+1
  88.    l4.i=Pos("DIVREST", s4.i); if l4.i > 0 then Signal w41
  89.    w41:
  90.    if l4.i=0 then Signal w4e
  91.    b4.i=SubStr(s4.i, l4.i, 7)
  92.    s4.i=DelStr(s4.i, l4.i, 7)
  93.    if b4.i=="DIVREST" then n4.i="//"
  94.    s4.j=Insert(n4.i, s4.i, l4.i-1); s4=s4.j
  95.    i=i+1
  96.    signal A4
  97.    w4e:
  98.    Return
  99.  
  100. ErgFormat:
  101.   Procedure
  102.   arg u
  103.   if Pos(".", u)>0 & Pos("E", u)=0 then
  104.   do
  105.     do forever
  106.       lu=length(u)
  107.       if Pos("0", u, lu) > 0 then u=DelStr(u, lu); else leave
  108.     end
  109.     lu=length(u)
  110.     if Pos(".", u) = lu then u=DelStr(u, lu)
  111.    end
  112.    Return(u)
  113.